package nsh.cl.nd.khtn.mazedash.baseclasses;

import nsh.cl.nd.khtn.mazedash.GameConstant;
import nsh.cl.nd.khtn.mazedash.RootGameActivity;
import nsh.cl.nd.khtn.mazedash.game.play.PlayScene;

import org.andengine.input.touch.detector.SurfaceGestureDetectorAdapter;

import android.content.Context;

public class SwipeDetector extends SurfaceGestureDetectorAdapter {
	private PlayScene playScene;
	
	public SwipeDetector(RootGameActivity pContext) {
		super(pContext);
	}

	public SwipeDetector(Context pContext, float pSwipeMinDistance) {
		super(pContext, pSwipeMinDistance);
	}
	
	@Override
	protected boolean onSingleTap() {
		playScene.getMainChar().setColor(GameConstant.GENERATOR.nextFloat(), GameConstant.GENERATOR.nextFloat(),
				GameConstant.GENERATOR.nextFloat());
		return false;
	}

	@Override
	protected boolean onDoubleTap() {
		playScene.getParticleSystem().reset();
		return false;
	}

	@Override
	protected boolean onSwipeUp() {
		playScene.getMapManager().moveUp();
		return true;
	}

	@Override
	protected boolean onSwipeDown() {
		playScene.getMapManager().moveDown();
		return true;
	}

	@Override
	protected boolean onSwipeLeft() {
		playScene.getMapManager().moveLeft();
		return true;
	}

	@Override
	protected boolean onSwipeRight() {
		playScene.getMapManager().moveRight();
		return true;
	}

	public PlayScene getPlayScene() {
		return playScene;
	}

	public void setPlayScene(PlayScene playScene) {
		this.playScene = playScene;
	}
}
